/*
 * $Id: SystemContactLogsDAO.java,v 1.2 2009/07/10 15:18:36 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2008 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.database.dao;

import java.util.ArrayList;
import java.util.List;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.healthcare.autosc.common.database.pojo.HstSystemContactInfo;
import com.ge.healthcare.autosc.common.database.pojo.HstSystemContactLogs;

public class SystemContactLogsDAO extends BaseDAO implements
		ISystemContactLogsDAO {

	/**
	 * Eclipse generated
	 */
	private static final long serialVersionUID = -5155650257196851390L;

	public SystemContactLogsDAO() {
		super(HstSystemContactLogs.TABLE_NAME);
	}

	public HstSystemContactLogs getSystemContactLogsByID(
			Long systemContactLogsId) {
		Object systemContactLogs = findObjectByID(
				HstSystemContactLogs.COL_SYSTEM_CONTACT_LOGS_ID,
				systemContactLogsId);
		if (!ASCUtil.isNullOrEmptyObject(systemContactLogs)) {
			return (HstSystemContactLogs) systemContactLogs;
		}
		return null;
	}

	public List<HstSystemContactLogs> getSystemContactLogsByContactInfoId(
			HstSystemContactInfo systemContactInfo) {
		List<?> rtvdLogs = findByProperty(
				HstSystemContactLogs.COL_SYSTEM_CONTACT_INFO_ID,
				systemContactInfo);
		if (!ASCUtil.isNullOrEmptyList(rtvdLogs)) {
			List<HstSystemContactLogs> systemContactLogs = new ArrayList<HstSystemContactLogs>();
			for (int iCount = 0; iCount < rtvdLogs.size(); iCount++) {
				systemContactLogs.add((HstSystemContactLogs) rtvdLogs
						.get(iCount));
			}
			return systemContactLogs;
		}
		return null;
	}

	public void saveAlways(Object pojo) {
		super.save(pojo);
	}

}
